package hn.cch.feature.scheduled;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component
public class FeatureScheduled {

    private static final Logger logger = LoggerFactory.getLogger(FeatureScheduled.class);

    @Scheduled(fixedRate = 10 * 1000L)
    public void test() {
        try {
            logger.info("run:{}", Thread.currentThread());
            TimeUnit.SECONDS.sleep(10 * 1000L);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

}
